﻿<Page x:Class="CentroVentas.Forms.Venta.Venta"
	  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	  xmlns:xt="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"
	  mc:Ignorable="d"
	  d:DesignHeight="768"
	  d:DesignWidth="1024"
	  Title="Venta">
	<ScrollViewer HorizontalScrollBarVisibility="Auto">
		<xt:BusyIndicator Name="Busy"
						  IsBusy="False"
						  BusyContent="Espere...">
			<StackPanel Orientation="Vertical">
				<Grid>
					<TextBlock Text="Venta"
							   FontSize="24"
							   Margin="0,10,20,0"
							   HorizontalAlignment="Right"
							   Width="79" />
				</Grid>
				<!--<GroupBox Header="Datos">                    
				</GroupBox>-->
				<GroupBox Header="Productos">
					<StackPanel Orientation="Vertical">
						<StackPanel Orientation="Horizontal"
									Width="998"
									HorizontalAlignment="Left">
							<StackPanel Orientation="Vertical"
										Width="356">
								<TextBlock Text="Producto"
										   Margin="15,15,0,0"
										   Width="100"
										   HorizontalAlignment="Left" />
								<xt:WatermarkTextBox Name="txtProducto"
													 Width="330"
													 Margin="15,0,0,0"
													 Watermark="Presione F2 para buscar..."
													 HorizontalAlignment="Left"
													 KeyDown="txtProducto_KeyDown"></xt:WatermarkTextBox>
								<TextBlock Name="NombreProducto"
										   Margin="15,0,0,15"/>
							</StackPanel>
							<StackPanel Orientation="Vertical"
										Width="253">
								<TextBlock Text="Cantidad"
										   Margin="15,15,0,0"
										   Width="100"
										   HorizontalAlignment="Left" />                                
								<StackPanel Orientation="Horizontal">
									<xt:IntegerUpDown Name="txtCantidad"
													  Margin="15,0,0,15"
													  Width="150"
													  HorizontalAlignment="Left"
													  KeyDown="txtCantidad_KeyDown"
													  Increment="1"
													  FormatString="N0"
													  Watermark="Ingrese cantidad"
													  AllowSpin="True"
													  DefaultValue="1" 
													  IsEditable="True"
													  SelectAllOnGotFocus="True"
													  ShowButtonSpinner="True"
													  Minimum="0"/>
									<TextBlock Text=" / 0"
											   Margin="0"
											   HorizontalAlignment="Left"
											   Name="txtCantidadDisponible"/>
								</StackPanel>
							</StackPanel>
						</StackPanel>
						<StackPanel Orientation="Horizontal">
							<DataGrid Name="GrillaVenta"
									  Height="500"
									  Width="800"
									  ItemsSource="{ Binding }"
									  AutoGenerateColumns="False"
									  CanUserAddRows="False"
									  CanUserDeleteRows="False"
									  CanUserReorderColumns="False"
									  CanUserResizeColumns="True"
									  CanUserResizeRows="False"
									  CanUserSortColumns="False">
								<DataGrid.Columns>
									<DataGridTextColumn Header="Id"
														x:Name="CPID"
														Binding="{Binding Path=IdProd}"
														IsReadOnly="True" />
									<DataGridTextColumn Header="Código Barras"
														x:Name="CCodProd"
														Binding="{Binding Path=CodBarras}"
														IsReadOnly="True" />
									<DataGridTextColumn Header="Descripción"
														x:Name="CDescProd"
														Binding="{Binding Path=Descripcion}"
														IsReadOnly="True" />
									<DataGridTextColumn Header="Precio"
														x:Name="CPrecio"
														Binding="{Binding Path=Precio}"
														IsReadOnly="True" />
									<DataGridTextColumn Header="Cantidad"
														x:Name="CPCantidad"
														Binding="{Binding Path=Cantidad}"
														IsReadOnly="True" />
									<DataGridTextColumn Header="Subtotal"
														x:Name="CPSubtotal"
														Binding="{Binding Path=SubTotal}"
														IsReadOnly="True" />
								</DataGrid.Columns>
							</DataGrid>
								<StackPanel Orientation="Vertical">
								<Grid Width="auto">
									<Grid.ColumnDefinitions>
										<ColumnDefinition />
										<ColumnDefinition />
									</Grid.ColumnDefinitions>
									<Grid.RowDefinitions>
										<RowDefinition />
										<RowDefinition />
										<RowDefinition />
										<RowDefinition />
									</Grid.RowDefinitions>
									<StackPanel Grid.Column="0"
												Grid.Row="0"
												Margin="10,90,0,0"
												d:LayoutOverrides="Margin">
										<TextBlock x:Name="lblPrecio"
												   Text="Precio"
												   FontSize="15" />
									</StackPanel>
									<StackPanel Grid.Column="1"
												Grid.Row="0"
												Margin="0,90,10,0"
												d:LayoutOverrides="Margin">
										<TextBlock x:Name="txtPrecio"
												   Text="$ 0."
												   FontSize="15"
												   FontWeight="Bold" />
									</StackPanel>
									<StackPanel Grid.Column="0"
												Grid.Row="1"
												Margin="10,20,0,0"
												d:LayoutOverrides="Margin">
										<TextBlock x:Name="lblCantidad"
												   Text="Cantidad:"
												   FontSize="15" />
									</StackPanel>
									<StackPanel Grid.Column="1"
												Grid.Row="1"
												Margin="0,20,10,0"
												d:LayoutOverrides="Margin">
										<TextBlock x:Name="txtCantidadTotal"
												   Text="0."
												   FontSize="15"
												   FontWeight="Bold" />
									</StackPanel>
									<StackPanel Grid.Row="1"
												Grid.Column="0"
												Grid.ColumnSpan="2"
												HorizontalAlignment="Center"
												VerticalAlignment="Bottom"
												Margin="15,-30"
												Height="22"
												Width="200"
												d:LayoutOverrides="Margin">
										<Button Name="btnAceptarVenta"
												Width="200"
												Content="Generar venta" />
									</StackPanel>
								</Grid>
							</StackPanel>
						</StackPanel>
					</StackPanel>
				</GroupBox>
			</StackPanel>
		</xt:BusyIndicator>
	</ScrollViewer>
</Page>
